package ru.st.selenium.dessignPatterns;

import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.testng.annotations.*;

public class PageObjectPatterns_1 extends ru.st.selenium.pages.TestBase {
	

	@Test
	public void shouldCheckButtonOnChapter2Page() {
		loadHomePage();
		clickAndLoadChapter2();
		Assert.assertEquals(driver.findElements(By.id("but1")).size(), 1);
	}
	
	@Test
	public void shouldCheckAnotherButtonOnChapter2Page() {
		loadHomePage();
		clickAndLoadChapter2();
		Assert.assertEquals(driver.findElements(By.id("verifybutton")).size(), 1);
	}
	
	private void loadHomePage() {
		driver.get("http://book.theautomatedtester.co.uk");
	}

	private void clickAndLoadChapter2() {
		driver.findElement(By.linkText("Chapter2")).click();
	}
	

}
	

